package com.example.demo;

import ch.qos.logback.core.util.StringUtil;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yaml.snakeyaml.util.ArrayUtils;

@RestController
@RequestMapping("/User")
public class Userlogin {
    @RequestMapping("/login")
    public Boolean login(String Username, String password, HttpSession httpSession){
        //验证登录信息是否正确
        if(StringUtil.isNullOrEmpty(Username)||password!=null||"".equals(password)){
            return false;
        }
        if("admin".equals(Username)&&"123456".equals(password)){
            //储存
            httpSession.setAttribute("loginUsername",Username);
            return true;
        }
        return false;
    }
}
